Multi-Dispatch in the Java Virtual Machine: Design and Implementation
نویسندگان
چکیده
Mainstream object-oriented languages, such as C++ and Java1, provide only a restricted form of polymorphic methods, namely uni-receiver dispatch. In common programming situations, developers must work around this limitation. We describe how to extend the Java Virtual Machine to support multi-dispatch and examine the complications that Java imposes on multidispatch in practice. Our technique avoids changes to the Java programming language itself, maintains source code and library compatibility, and isolates the performance penalty and semantic changes of multi-method dispatch to the program sections which use it. We have micro-benchmark and application-level performance results for a dynamic Most Specific Applicable (MSA) dispatcher, a framework-based Single Receiver Projections (SRP) dispatcher, and a tuned SRP dispatcher. Our general-purpose technique provides smaller dispatch latency than programmer-written double-dispatch code with equivalent functionality.
منابع مشابه
Effective Inline-Threaded Interpretation of Java Bytecode Using Preparation Sequences
Inline-threaded interpretation is a recent technique that improves performance by eliminating dispatch overhead within basic blocks for interpreters written in C [11]. The dynamic class loading, lazy class initialization, and multi-threading features of Java reduce the effectiveness of a straight-forward implementation of this technique within Java interpreters. In this paper, we introduce prep...
متن کاملDynamic Profiling and Trace Cache Generation for a Java Virtual Machine
Dynamic program optimization is becoming increasingly important for achieving good runtime performance. One of the key issues in such systems is how it selects which code to optimize. One approach is to dynamically detect traces, long sequences of instructions which are likely to execute to completion. Such traces can be stored in a trace cache and dispatched one trace at a time (rather than on...
متن کاملExperience Report: Speeding up a Nested VM Using Bytecode Comp
The focus of this paper is Weld, a bytecode compiler that compiles a given Java class into a new Java class with added compiled methods. The Java bytecode to Java bytecode compilation that Weld performs is key to accelerating Rivet, a Java virtual machine written in Java that serves as an extensible tool platform. In accelerating Rivet, Weld employs several bytecode compilation techniques. Some...
متن کاملComprehensive Profiling Support in the Java Virtual Machine
Existing profilers for Java applications typically rely on custom instrumentation in the Java virtual machine, and measure only limited types of resource consumption. Garbage collection and multi-threading pose additional challenges to profiler design and implementation. In this paper we discuss a general-purpose, portable, and extensible approach for obtaining comprehensive profiling informati...
متن کاملSpace- and Time-Efficient Implementation of the Java Object Model
While many object-oriented languages impose space overhead of only one word per object to support features like virtual method dispatch, Java’s richer functionality has led to implementations that require two or three header words per object. This space overhead increases memory usage and attendant garbage collection costs, reduces cache locality, and constrains programmers who might naturally ...
متن کامل